Skip to content

Conversation

@krichprollsch
Copy link
Member

No description provided.

@krichprollsch krichprollsch self-assigned this Aug 20, 2025
@krichprollsch krichprollsch force-pushed the auth-challenge branch 2 times, most recently from 96950fa to fe3b9c2 Compare August 21, 2025 15:36
@krichprollsch krichprollsch changed the base branch from main to proxy-header August 21, 2025 17:40
@krichprollsch krichprollsch force-pushed the auth-challenge branch 5 times, most recently from f8acde6 to 48b742b Compare August 26, 2025 08:53
@krichprollsch krichprollsch marked this pull request as ready for review August 26, 2025 08:53
@krichprollsch krichprollsch changed the title WIP: auth required interception auth required interception Aug 26, 2025
Base automatically changed from proxy-header to main August 26, 2025 08:53
Copy link
Contributor

@sjorsdonkers sjorsdonkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good.
I do think it is important to keep a flag in the intercept state whether it is normal or auth intercept, see comment.
I'll continue testing it now.


var intercept_state = &bc.intercept_state;
const request_id = try idFromRequestId(params.requestId);
const transfer = intercept_state.remove(request_id) orelse return error.RequestNotFound;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a flag to make sure that it was a auth interception and not a normal intercept.
Otherwise the situation may occur that a user sends a continueWithAuth as a responce to a requestPaused.
In that case for example if we call abortAuthChallenge we do not do the correct cleanup. In general we do not know what could happen, so better to catch it.

Copy link
Member Author

@krichprollsch krichprollsch Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about testing if the transfer has a auth challenge?
Or you do want a complete separate intercept_state list?

Copy link
Contributor

@sjorsdonkers sjorsdonkers Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking and I guess then removing the auth challenge should work, then the opposite for continue/abort/fulfill

// In this case we ignore callbacks for now.
// Note: we don't deinit transfer on purpose: we want to keep
// using it for the following request.
self.endTransfer(transfer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether we need to send a transfer.resetCallback as consumer may need to reset their state for the replaced intercept to be sent.
Or we can make it part of the contract that this is the case when transfer.start_callback is called for the same transfer, but we probably should document that perhaps near: start_callback: ?*const fn (transfer: *Transfer) anyerror!void = null, in Request.

| don't see issue with the current consumers implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, I suppose the point of the interception is to take place during the request lifecycle. So the following callbacks will be called depending the result of the interception and the optional request following.

@krichprollsch krichprollsch force-pushed the auth-challenge branch 2 times, most recently from 0facf97 to 9d4bc72 Compare August 26, 2025 15:38
@krichprollsch krichprollsch merged commit 7647ce9 into main Aug 27, 2025
10 checks passed
@krichprollsch krichprollsch deleted the auth-challenge branch August 27, 2025 13:34
@github-actions github-actions bot locked and limited conversation to collaborators Aug 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants